
<div class="control-group <?php $form[$name]->hasError() and print ' error' ?>">
    <?php echo $form[$name]->renderLabel($form->getWidget($name)->getLabel(),array('class' => 'control-label')) ?>
    <div class="controls">
        <?php echo $form[$name]->render($form->getWidget($name)->getAttributes() instanceof sfOutputEscaper ? $form->getWidget($name)->getAttributes()->getRawValue() : $form->getWidget($name)->getAttributes()) ?>
        <?php echo $form[$name]->renderError() ?>

        <?php if ($form->getWidgetSchema()->getHelp($name)): ?>
        <span class="help-block"><?php echo __($form->getWidgetSchema()->getHelp($name), array(), 'messages') ?></span>
        <?php elseif ($help = $form[$name]->renderHelp()): ?>
        <span class="help-block"><?php echo $help ?></span>
        <?php endif; ?>
    </div>
</div>